package org.poker.prophecy.simulation.action;

import org.apache.log4j.Logger;
import org.poker.prophecy.player.general.Player;
import org.poker.prophecy.simulation.process.RoundProcess;

public class FoldAction extends AbstractAction{

	private static Logger classLogger = Logger.getLogger(FoldAction.class);
	
	public FoldAction(Player player, RoundProcess roundProcess){
		super(roundProcess, player, ActionType.FOLD, roundProcess.getCurrentProcessType());
    }
	
	public void action(){
		roundProcess.getTicker().talk(player, "I fold.");
		roundProcess.setFolded(player);
		this.archive();
		
		//Hat damit der vorletzte Spieler gefoldet?
		if (roundProcess.getCurrentPlayersWhoHaventFolded().size() == 1){
			roundProcess.getCurrentProcess().setCompleted();
			roundProcess.setRoundOver(true);
		}
	}
	
}
